var express = require('express');
var router = express.Router();
var db = require('../model/index')


/* 微信 */
router.get('/getwx', function (req, res, next) {
  let {
    y,
    m
  } = req.query;
  let mysql = `SELECT * FROM wx_jizhang WHERE DATE LIKE '${y}-${m}-__' ORDER BY DATE DESC;`
  db(mysql, function (err, data) {
    if (err) {
      return res.json({
        code: 500,
        msg: '更新登陆时间失败'
      })
    }
    // data.forEach((item) => {
    //   console.log(JSON.stringify(item.date))
    //   item.date = new Date(JSON.stringify(item.date));
    // });
    // console.log(data)
    res.json({
      code: 200,
      msg: '更新登陆时间成功',
      data: data
    })
  });
});
module.exports = router;